from typing import (
    TypedDict,
    Optional,
    Union,
    Literal
)

class GeoIPRaw(TypedDict):
    ip: str
    city: str
    region: str
    country: str
    loc: str
    org: str
    postal: str
    timezone: str
    readme: str

class GeoIPProperties(TypedDict):
    address: str
    city: str
    country: str
    ip: str
    lat: float
    lng: float
    ok: bool
    org: str
    postal: str
    raw: GeoIPRaw
    state: str
    status: str

class GeoIPGeometry(TypedDict):
    type: str
    coordinates: list[float]

class GeoIPFeatures(TypedDict):
    type: str
    properties: GeoIPProperties
    geometry: GeoIPGeometry

class GeoIP(TypedDict):
    type: str
    features: list[GeoIPFeatures]

class WeatherRefer(TypedDict):
    sources: list[str]
    license: list[str]

class _WeatherNow(TypedDict):
    obsTime: str
    temp: str
    feelsLike: str
    icon: str
    text: str
    wind360: str
    windDir: str
    windScale: str
    windSpeed: str
    humidity: str
    precip: str
    pressure: str
    vis: str
    cloud: str
    dew: str

class WeatherNow(TypedDict):
    code: str
    updateTime: str
    fxLink: str
    now: _WeatherNow
    refer: WeatherRefer

class _WeatherDays(TypedDict):
    fxData: str
    sunrise: str
    sunset: str
    moonrise: str
    moonset: str
    moonPhase: str
    moonPhaseIcon: str
    tempMax: str
    tempMin: str
    iconDay: str
    textDay: str
    iconNight: str
    textNight: str
    wind360Day: str
    windDirDay: str
    windScaleDay: str
    windSpeedDay: str
    wind360Night: str
    windDirNight: str
    windScaleNight: str
    windSpeedNight: str
    humidity: str
    precip: str
    pressure: str
    vis: str
    cloud: str
    uvIndex: str

class WeatherDays(TypedDict):
    code: str
    updateTime: str
    fxLink: str
    daily: list[_WeatherDays]
    refer: WeatherRefer

class _WeatherHours(TypedDict):
    fxTime: str
    temp: str
    icon: str
    text: str
    wind360: str
    windDir: str
    windScale: str
    windSpeed: str
    humidity: str
    precip: str
    pressure: str
    vis: str
    cloud: str
    dew: str

class WeatherHours(TypedDict):
    code: str
    updateTime: str
    fxLink: str
    hourly: list[_WeatherHours]
    refer: WeatherRefer

class _WeatherWarning(TypedDict):
    id: str
    sender: str
    pubTime: str
    title: str
    startTime: str
    status: str
    level: str
    severity: str
    severityColor: str
    type: str
    typeName: str
    urgency: str
    certainty: str
    text: str
    related: str

class WeatherWarning(TypedDict):
    code: str
    updateTime: str
    fxLink: str
    warning: list[_WeatherWarning] | str
    refer: WeatherRefer

class _WeatherIndices(TypedDict):
    date: str
    type: str
    name: str
    level: str
    category: str
    text: str

class WeatherIndices(TypedDict):
    code: str
    updateTime: str
    fxLink: str
    daily: list[_WeatherIndices]
    refer: WeatherRefer

class _WeatherHistoryDaily(TypedDict):
    date: str
    sunrise: str
    sunset: str
    moonrise: str
    moonset: str
    moonPhase: str
    tempMax: str
    tempMin: str
    humidity: str
    precip: str
    pressure: str

class _WeatherHistoryHourly(TypedDict):
    time: str
    temp: str
    icon: str
    text: str
    precip: str
    wind360: str
    windDir: str
    windScale: str
    windSpeed: str
    humidity: str
    pressure: str

class WeatherHistory(TypedDict):
    code: str
    updateTime: str
    fxLink: str
    weatherDaily: _WeatherHistoryDaily
    weatherHourly: list[_WeatherHistoryHourly]
    refer: WeatherRefer

Unit = Optional[Literal['m', 'i']]
_Language = Literal[
    'zh', 'zh-hans', 'zh-hant', 'en', 'de', 'es', 'fr', 'it', 'ja', 'ko',
    'ru', 'hi', 'th', 'ar', 'pt', 'bn', 'ms', 'nl', 'el', 'la', 'sv',
    'id', 'pl', 'tr', 'cs', 'et', 'vi', 'fil', 'fi', 'he', 'is', 'nb'
]
Language = Optional[_Language]
Days = Literal[3, 7, 10, 15, 30]
Hours = Literal[24, 72, 168]
Indices = Literal[1, 3]
_IndicesType = Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
IndicesType = Union[_IndicesType, list[_IndicesType]]
